package com.game.utils;

import com.game.beans.EnemyBean;
import com.game.beans.GameBean;
import com.game.beans.ShellBean;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class GameUtils {

    public static BufferedImage bgImg;
    public static BufferedImage airplaneImg ;
    public static BufferedImage beeImg ;
    public static BufferedImage bulletImg ;
    public static BufferedImage gameOverImg ;
    public static BufferedImage heroImg ;
    public static BufferedImage heroSImg ;
    public static BufferedImage pauseImg ;
    public static BufferedImage startImg ;




    public static List<GameBean> gameBeans = new ArrayList<>();
    public static List<ShellBean> shellBeans = new ArrayList<>();
    public static List<EnemyBean> enemyBeans = new ArrayList<>();
    public static List<GameBean> removeBeans = new ArrayList<>();


    static {
        try {
            bgImg = ImageIO.read(new File("img/background.png"));
            airplaneImg = ImageIO.read(new File("img/airplane.png"));
            beeImg = ImageIO.read(new File("img/bee.png"));
            bulletImg = ImageIO.read(new File("img/bullet.png"));
            gameOverImg = ImageIO.read(new File("img/gameover.png"));
            heroImg = ImageIO.read(new File("img/hero0.png"));
            heroSImg = ImageIO.read(new File("img/hero1.png"));
            pauseImg = ImageIO.read(new File("img/pause.png"));
            startImg = ImageIO.read(new File("img/start.png"));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public static void drawWords(Graphics graphics,String str,Color color,int x,int y,int fontSize){
        graphics.setColor(color);
        graphics.setFont(new Font("仿宋",Font.BOLD,fontSize));
        graphics.drawString(str,x,y);
    }

}
